<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>picker</title>

    <style>
        * {font-family: UKIJ Ekran;}
    </style>

    <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.6.0/css/bootstrap.css" rel="stylesheet">

    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.4/jquery.js"></script>
    <script src="./distpicker.js"></script>
</head>

<body dir="rtl">

    <div class="container text-right">
        <div class="mt-5">
            <div id="distpicker" data-toggle="distpicker" data-value-type="code" class="d-flex">
                <div class="col-md-4">
                    <select class="form-control" id="province" data-province="650000"></select>
                </div>
                <div class="col-md-4">
                    <select class="form-control" id="city"></select>
                </div>
                <div class="col-md-4">
                    <select class="form-control" id="district"></select>
                </div>
            </div>
        </div>
        <br>
        <span id="result" class="mt-2">رايون تاللاڭ: </span>
    </div>


    <script>
        $("#distpicker").distpicker();

        $("#district").on('change',function() {
            var province = $("#province option:selected").text();
            var city = $("#city option:selected").text();
            var district = $("#district option:selected").text();

            if(city === district){
                var result = "تاللىغىنىڭىز: " + district;
                $("#result").text(result);
            }else{
                var result = "تاللىغىنىڭىز: " + city + "-" + district;
                $("#result").text(result);
            }
        });
    </script>
</body>

</html>